<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.0/css/all.min.css">
    <link rel="stylesheet" href="/css/login.css">
</head>
<body>
<div class="container">
    <div class="row justify-content-center">
        <div class="col-lg-5">
            <div class="card">
                <div class="card-header">
                    <h2 class="mb-0">登录</h2>
                </div>
                <div class="card-body">
                    <!-- 显示登录错误信息 -->
                    <div th:if="${param.error}" class="alert alert-danger">
                        用户名、密码或角色错误，请重试。
                    </div>
                    <!-- 显示登录成功信息 -->
                    <div th:if="${param.logout}" class="alert alert-success">
                        您已成功登出。
                    </div>
                    <form action="#" th:action="@{/login}" method="post">
                        <div class="mb-3">
                            <label for="username" class="form-label">用户名</label>
                            <input type="text" class="form-control" id="username" name="username" required>
                        </div>
                        <div class="mb-3">
                            <label for="password" class="form-label">密码</label>
                            <input type="password" class="form-control" id="password" name="password" required>
                        </div>
                        <div class="mb-3">
                            <label for="role" class="form-label">角色</label>
                            <select class="form-select" id="role" name="role">
                                <option value="ADMIN">管理员</option>
                                <option value="USER">普通用户</option>
                            </select>
                        </div>
                        <div class="d-flex justify-content-between align-items-center">
                            <button type="submit" class="btn btn-primary">登录</button>
                            <a th:href="@{/register}" class="text-primary">注册</a>
                        </div>
                    </form>
                </div></div></div></div></div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>